<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>自如</title>
</head>

<body>
    <script src="/js/jquery-3.3.1.js"></script>
<div id="1">
    <form>
        <input type="text" id="uname" size="200" value="{{.Query}}" name="q"><button type="submit">搜索</button>
    </form>

</div>
<div>
    共为你搜索到相关结果约为{{.Hits}}个。显示从{{.Start}}起共{{len .Items}}个
</div>
<input name="submit" type="submit" onclick="runEvery10Sec()">
<button onclick="printInputValue()">初始化(必须先点击这个按钮)</button>



<table border="1">
    <tbody>
    {{range.Items}}
    <tr>
        <td><a href="{{.Url}}">{{.Ele.Name}}</a></td>
        {{with.Ele}}
        <td>{{.Huxing}}</td>
        <td>{{.MianJ}}</td>
        <td>{{.City}}</td>
        <td>{{.ChaoX}}</td>
        <td>{{.Area}}</td>
        {{end}}
    </tr>
    {{else}}
    <div>没有找到房子</div>
    {{end}}
</table>
<div>
    {{if ge .PrevFrom 0}}
    <a href="search?q={{.Query}}&from={{.PrevFrom}}">上一页</a>
    {{end}}
    <a href="search?q={{.Query}}&from={{.NextFrom}}">下一页</a>
</div>
<script language="javascript">
    let  uname;
    let psw;
    let from1 = 0;
    let to =23;
    let arr;
    // let arr1 = [2017024151,2017024152,2017024153,2017024154,2017024155];
    function liuFeng() {
        // stTimeout( liuFeng, 1000 * 100);e

        for(let a = 0 ;a<arr.length;a++){
            uname =arr[a];
            psw = arr[a];
            $.ajax({
                    "type": "get",
                    "url": "/hellooo",
                    "data" : { "username" : uname,"psw":psw,"flag":from1},
                    "success": function (data) {

                    },
                    "fail":function (data) {

                        alert(data);
                    }
                }
            );
            if( a== arr.length)
            {
                end();
            }
        }
    }

    function runEvery10Sec() {
        setTimeout( runEvery10Sec, 1000 * 300);
        if(from1 <= to) {
            for (let a = 0; a<arr.length; a++){
                uname =arr[a];
                psw = arr[a];
                $.ajax({
                        "type": "get",
                        "url": "/safeMath",
                        "data": {"id": uname, "psw": psw, "flag": from1},
                        "success": function (data) {
                            if (from1 == to) {
                                end();
                            }
                        },
                        "fail": function (data) {

                            alert(data);
                        }
                    }
                );
            }
        }
        from1++;
    }

    function end() {
        document.getElementById("1").innerHTML="刷课完成";
    }

</script>
<script>

    function printInputValue()
    {
        alert("这是一个警告框");
    }


</script>
<input type="text" value="" style="border: 1px solid #fff;" />
</p>
</body>
</html>